package com.grgbanking.it.system.dao.impl;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.grgbanking.it.base.BaseDao;
import com.grgbanking.it.system.dao.IWXDepartmentDao;
import com.grgbanking.it.system.entity.WXDepartment;


/**
 * 微信部门
 * 
 * WXDepartmentDao
 * 
 * @author 潘广伟
 * @Email p_3er@qq.com
 * @Date 2014-12-26 上午9:54:07
 * 
 * @version 1.0.0
 *
 */
@Repository 
public class WXDepartmentDao extends BaseDao<WXDepartment, Integer> implements IWXDepartmentDao<WXDepartment, Integer> {
    @Autowired  
    public void setMySessionFactory(SessionFactory sessionFactory){  
        super.setSessionFactory(sessionFactory);  
    }

	@Override
	public Integer getWXId(Integer departmentId) {
		StringBuffer hql = new StringBuffer("from WXDepartment t where");
		hql.append(" t.departmentId=").append(departmentId);
		
		List<WXDepartment> list = this.findByHql(hql.toString());
		if(list.size() > 0){
			return list.get(0).getWxId();
		}
		
		return 0;
	}
    

}